<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useLoadingPage } from '@/utils/LoadingHelper'
import { onMounted, ref } from 'vue'
import gsap from 'gsap'

const router = useRouter()

const startFullProcessInterview = () => {
  router.push('/full/interview/confirm')
}

const resumeUpload = () => {
  router.push('/resume/upload')
}

const startWrittenInterview = () => {
  router.push('/written/Interview/confirm')
}

const startTechInterview = () => {
  router.push('/tec/interview/confirm')
}

const startHRInterview = () => {
  router.push('/hr/interview/confirm')
}

onMounted(() => {
  gsap.from('.home-container', { opacity: 0, y: 40, duration: 1, ease: 'power3.out' })
  gsap.from('.hero-title', { opacity: 0, y: -30, duration: 0.8, delay: 0.2, ease: 'power2.out' })
  gsap.from('.hero-subtitle', { opacity: 0, y: 20, duration: 0.7, delay: 0.3 })
  gsap.from('.hero-buttons .a-button', {
    opacity: 0,
    y: 20,
    duration: 0.7,
    delay: 0.4,
    stagger: 0.1,
  })
  gsap.from('.hero-image img', {
    scale: 0.9,
    opacity: 0,
    duration: 1,
    delay: 0.5,
    ease: 'expo.out',
  })
  gsap.from('.hero-image-bg', {
    opacity: 0,
    scale: 0.95,
    duration: 1,
    delay: 0.7,
    ease: 'sine.inOut',
  })
})
</script>

<template>
  <div class="home-container">
    <section class="hero-section">
      <div class="hero-content">
        <h1 style="font-size: 45px">
          <span style="color: #4795ea; font-weight: bold">面试通</span
          >-基于多模态分析的智能面试评测系统
        </h1>
        <p class="hero-subtitle">让面试准备更智能，求职更高效</p>
        <div class="hero-buttons">
          <a-button type="primary" size="large" @click="startFullProcessInterview" class="primary-btn">
            开始模拟面试
          </a-button>
          <a-button size="large" @click="resumeUpload" class="secondary-btn"> 简历筛选 </a-button>
          <a-button size="large" @click="startWrittenInterview" class="secondary-btn"> 笔试 </a-button>
          <a-button size="large" @click="startTechInterview" class="secondary-btn">
            技术面试
          </a-button>
          <a-button size="large" @click="startHRInterview" class="secondary-btn"> HR面试 </a-button>
        </div>
      </div>
      <div class="hero-image">
        <img src="../../../assets/cartoonInterviewer.png" alt="AI面试助手" />
        <div class="hero-image-bg"></div>
      </div>
    </section>
  </div>
</template>

<style scoped>
.home-container {
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  width: 100%;
  height: 100%;
}

/* 英雄区域 */
.hero-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5%;
  height: 100%;
  overflow: hidden;
}

.hero-content {
  max-width: 50%;
  z-index: 10;
}

.hero-title {
  color: #000;
  font-weight: 700;
  font-size: 3.5rem;
  100% {
    opacity: 1;
  }
}

.highlight {
  color: #1890ff;
  font-weight: 800;
}

.hero-subtitle {
  font-size: 1.4rem;
  color: #666;
  margin-bottom: 40px;
  line-height: 1.6;
}

.hero-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.primary-btn {
  height: 50px;
  font-size: 16px;
  padding: 0 30px;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(24, 144, 255, 0.2);
  grid-column: span 2;
}

.secondary-btn {
  height: 48px;
  font-size: 16px;
  padding: 0 20px;
  border-radius: 8px;
  border: 1px solid #1890ff;
  color: #1890ff;
  transition: all 0.3s;
}

.secondary-btn:hover {
  background-color: rgba(24, 144, 255, 0.1);
}

.hero-image {
  position: relative;
  flex: 1;
  max-width: 45%;
  z-index: 5;
}

.hero-image img {
  width: 100%;
  max-width: 600px;
  animation: float 6s ease-in-out infinite;
}

.hero-image-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  background: radial-gradient(circle, rgba(24, 144, 255, 0.1) 0%, rgba(24, 144, 255, 0) 70%);
  z-index: -1;
  border-radius: 50%;
}

/* 动画 */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* 媒体查询 */
@media (max-width: 992px) {
  .hero-section {
    flex-direction: column;
    text-align: center;
    padding: 60px 5%;
    height: auto;
  }

  .hero-content {
    max-width: 100%;
    margin-bottom: 50px;
  }

  .hero-buttons {
    justify-content: center;
  }

  .hero-image {
    max-width: 80%;
  }
}

/* 小屏幕设备的进一步优化 */
@media (max-width: 576px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .hero-buttons {
    grid-template-columns: 1fr;
  }

  .primary-btn {
    grid-column: span 1;
  }
}
</style>
